home *** CD-ROM | disk | FTP | other *** search
/ Collection of Tools & Utilities / Collection of Tools and Utilities.iso / comm / uwpc201.zip / UW-SRC.ZIP / UW.H < prev    next >
C/C++ Source or Header  |  1991-11-02  |  6KB  |  177 lines

  1. //-------------------------------------------------------------------------
  2. //
  3. // UW.H - Declarations for the UW protocol within UW/PC.
  4. // 
  5. //  This file is part of UW/PC - a multi-window comms package for the PC.
  6. //  Copyright (C) 1990-1991  Rhys Weatherley
  7. //
  8. //  This program is free software; you can redistribute it and/or modify
  9. //  it under the terms of the GNU General Public License as published by
  10. //  the Free Software Foundation; either version 1, or (at your option)
  11. //  any later version.
  12. //
  13. //  This program is distributed in the hope that it will be useful,
  14. //  but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. //  GNU General Public License for more details.
  17. //
  18. //  You should have received a copy of the GNU General Public License
  19. //  along with this program; if not, write to the Free Software
  20. //  Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
  21. //
  22. // Revision History:
  23. // ================
  24. //
  25. //  Version  DD/MM/YY  By  Description
  26. //  -------  --------  --  --------------------------------------
  27. //    1.0    23/03/91  RW  Original Version of UW.H
  28. //    1.1    05/05/91  RW  Cleanup phase.
  29. //    1.2    26/05/91  RW  Add command-line to "jumpdos".
  30. //
  31. // You may contact the author by:
  32. // =============================
  33. //
  34. //  e-mail: rhys@cs.uq.oz.au
  35. //    mail: Rhys Weatherley
  36. //          5 Horizon Drive
  37. //          Jamboree Heights
  38. //          Queensland 4074
  39. //        Australia
  40. //
  41. //-------------------------------------------------------------------------
  42.  
  43. #ifndef __UW_H__
  44. #define    __UW_H__
  45.  
  46. //
  47. // Forward declarations of some classes needed by the UWProtocol class.
  48. //
  49. class    UWDisplay;
  50. class    UWClient;
  51.  
  52. //
  53. // Define the top-level interface to the UW protocol routines.
  54. // The static object "UWMaster" is the only object of this
  55. // type and once the program is initialised, it is in control
  56. // of all communication.
  57. //
  58. #define    NUM_UW_WINDOWS    8
  59.  
  60. class    UWProtocol {
  61.  
  62. private:
  63.  
  64.     int    CurrWindow;    // Current window that is in use.
  65.     int    LastInput;    // Last input window.
  66.     int    RoundWindow;    // Round-robin service window.
  67.     int    OutputWindow;    // Current output window.
  68.     int    gotmeta;    // Non-zero for meta escape.
  69.     int    gotiac;        // Non-zero for IAC escape.
  70.     int    getpcl;        // For protocol negotiation.
  71.     int    dirproc;    // Non-zero for direct processing.
  72.  
  73.     UWClient  *clients[NUM_UW_WINDOWS];
  74.     UWDisplay *displays[NUM_UW_WINDOWS];
  75.     int    numwinds;    // Number of windows in service - 1.
  76.     UWClient  *freelist;    // List of clients to be freed.
  77.  
  78.     friend    class    UWClient;
  79.  
  80.     // Send a UW command to the remote host.
  81.     void    command (int cmd);
  82.  
  83.     // Send a character to the remote host in the
  84.     // round-robin service window.  This is called by
  85.     // the function UWClient::send.
  86.     void    send    (int ch);
  87.  
  88.     // Send a character to the "remote" method of
  89.     // the client attached to the output window.
  90.     void    remote    (int ch);
  91.  
  92.     // Process a character incoming from the host
  93.     void    fromhost (int ch);
  94.  
  95. public:
  96.  
  97.     int    terminate;    // Set this to non-zero to terminate program.
  98.     int    exitmulti;    // Set this to non-zero to exit UW session.
  99.     int    protocol;    // Number of the protocol that is in use.
  100.  
  101.     // Start the processing of the UW protocol.  When
  102.     // this method exits, the program has been terminated.
  103.     // On startup, an initial dumb terminal is created.
  104.     // Returns NULL or an error message.
  105.     char    *start    (void);
  106.  
  107.     // Pass a keypress from outside the UW protocol master.
  108.     // This is only called in the Windows 3.0 version.
  109.     void    sendkey    (int wind,int key);
  110.  
  111.     // Force the exit from Protocol 1 or higher, and a
  112.     // return to Protocol 0 (ignored in Protocol 0).
  113.     void    exit    (void);
  114.  
  115.     // Create a new window (ignored in Protocol 0).  Returns
  116.     // the identifier, or 0 if no window could be created.
  117.     // If number != 0, then the number has been supplied
  118.     // explicitly, usually by the remote host.
  119.     int    create    (int number=0);
  120.  
  121.     // Install a new client on top of the one in the current
  122.     // round-robin window.
  123.     void    install    (UWClient *newclient);
  124.  
  125.     // Remove the top-most client from the current round-
  126.     // robin window, and return to the client underneath.
  127.     void    remove    (void);
  128.  
  129.     // Display a new status line on the screen bottom
  130.     void    status    (void);
  131.  
  132.     // Turn direct character processing in protocol 0 on or off.
  133.     void    direct    (int on);
  134.  
  135.     // Kill a particular window.  Once all Protocol 1 or 2
  136.     // windows have been destroyed, "exit" is automatically
  137.     // called to exit the protocol service.  If number == 0,
  138.     // then the current window is killed.
  139.     void    kill    (int number=0);
  140.  
  141.     // Bring a particular window to the top (i.e. make it
  142.     // the current window).
  143.     void    top    (int number);
  144.  
  145.     // Cycle around to the next window in Protocol 1/2.
  146.     void    nextwindow (void);
  147.  
  148.     // Jump out to a DOS shell, and fix everything on return.
  149.     // Optionally execute a command in DOS.
  150.     void    jumpdos    (char *cmdline=0);
  151.  
  152.     // Hangup the modem and return to Protocol 0.
  153.     void    hangup    (void);
  154.  
  155.     // Send a modem control string through the current window.
  156.     // Modem control strings include initialisation, hangup, etc.
  157.     void    sendstring (char *str);
  158.  
  159.     // Exit protocol 1 and send a modem line break.
  160.     void    sendbreak (void);
  161.  
  162.     // Start a client service that was requested by a
  163.     // "^[|" escape sequence from the remote host.
  164.     void    startclient (int ch);
  165.  
  166.     // Minimize all windows except the given window.  This only
  167.     // has an effect in the Windows 3.0 version.
  168.     void    minall    (int wind);
  169. };
  170.  
  171. //
  172. // Define the master object for handling the UW protocol.
  173. //
  174. extern    UWProtocol    UWMaster;
  175.  
  176. #endif    /* __UW_H__ */
  177.